package com.example.exercise.app.feedback.controller;

import com.example.exercise.core.base.dto.BaseResponse;
import com.example.exercise.app.feedback.dto.request.AppFeedbackRequest;
import com.example.exercise.app.feedback.service.AppFeedbackService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/appFeedback")
//@Api(description = "用户反馈 -- 反馈、查看回复")
public class AppFeedbackController {

	@Resource
	private AppFeedbackService feedbackService;

//	@ApiOperation(value = "反馈内容入库", notes = "反馈内容")
	@RequestMapping(value = "saveFeedbackInfo", method = { RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE })
	public BaseResponse<Object> saveFeedbackInfo(@RequestBody AppFeedbackRequest feedbackRequest) {
		BaseResponse<Object> baseResponse = new BaseResponse<>();
		int count = feedbackService.insertAppFeedback(feedbackRequest);
		if(count > 0){
			baseResponse.ok();
		}else{
			baseResponse.setCode(-11);
			baseResponse.setMsg("数据为空");
		}
		return baseResponse;
	}

}